#ifndef POT_CLASSICAL_PROBLEMS_CLASSICAL_PROBLEMS_H
#define POT_CLASSICAL_PROBLEMS_CLASSICAL_PROBLEMS_H

#include <stdio.h>
#include <time.h>

namespace pot {

inline void Print(int A[], int n) {
  for (int i = 0; i < n; ++i)
    printf("%d, ", A[i]);
  printf("\n-----------------------------------------------\n");
}


/*
 * @description: Generate n random data, save into A, whose size should be greater than n
 * @verb: whether prints the generated data
 */
void GenSignedIntegers(int A[], int n);
void GenIntegersKnuth(int A[], int k, int n);
void GenIntegers(int A[], int k, int n);

void RandomTest();

/*
 * @description: Find the successive sequence in A that has the maximum sum
 * @return: the maximum sum
 * @A: array of integers
 * @n: number of integers in A
 * @start: the start of the sequence
 * @end: the end of the sequence
 */
int MaxSubSequenceSum(const int A[], int n, int *start, int *end);
int MaxSubSequenceSumNaive(const int A[], int n, int *start, int *end);

void MaxSubSequenceTest(int N);

/*
 * @description: Count the Ones from 1 to N, inclusive, in decimal
 * @return: the count of 1s
 */
int NumberOfOnes(int N);
int NumberOfOnesNaive(int N);

void NumberOfOnesTest(int N);
void NumberOfOnesTests(int N);

/*
 * @description: print the continuous sequence of integers that has the sum
 *               that equals N
 * @return: the number of such sequences
 */
int ContinuousSumSequenceUnRobust(long long N);

int ContinuousSumSequence(long long N);

long long NWithMaximumContinuousSumSequence();

void ContinuousSumSequenceTests(long long N);

/*
 * 8-queen
 */
void Place8QueenTest();

/*
 * @description: everse vector
 *
 */
void ShiftVector(int A[], int n);
void ShiftVectorTest();


/*
 * @description: compute greatest common divisor
 */
int gcd(int a, int b);
int gcd_stein(int a, int b);

void GcdTest();

/*
 * @description: sufix word array
 */
void SufixWordTest();

void RandomIntSetTest();

void AnagramTest();

void SortTest();

/*
 * @description: Game
 */
void Game24Points(int A[]);

void Game24PointsTest();

} // pot

#endif // POT_CLASSICAL_PROBLEMS_CLASSICAL_PROBLEMS_H
